//
//  GPChatToolMenuView.m
//  Keping
//
//  Created by 23 on 2017/12/6.
//  Copyright © 2017年 柯平. All rights reserved.
//

#import "GPChatToolMenuView.h"

@interface GPChatToolMenuView ()

@property (weak, nonatomic) IBOutlet UIButton *voiceButton;
@property (weak, nonatomic) IBOutlet UIButton *photosButton;
@property (weak, nonatomic) IBOutlet UIButton *cameraButton;
@property (weak, nonatomic) IBOutlet UIButton *videoButton;
@property (weak, nonatomic) IBOutlet UIButton *locationButton;
@property (weak, nonatomic) IBOutlet UIButton *emojiButton;


@end

@implementation GPChatToolMenuView

+ (instancetype)toolMenuView
{
    return [[NSBundle mainBundle] loadNibNamed:NSStringFromClass(self) owner:nil options:nil].firstObject;
}

- (void)awakeFromNib
{
    [super awakeFromNib];
    
    self.voiceButton.tag = GPChatToolMenuViewTypeVoice;
    self.voiceButton.imageView.contentMode = UIViewContentModeCenter;
    self.photosButton.tag = GPChatToolMenuViewTypePhotos;
    self.photosButton.imageView.contentMode = UIViewContentModeCenter;
    self.cameraButton.tag = GPChatToolMenuViewTypeCamera;
    self.cameraButton.imageView.contentMode = UIViewContentModeCenter;
    self.videoButton.tag = GPChatToolMenuViewTypeVideo;
    self.videoButton.imageView.contentMode = UIViewContentModeCenter;
    self.locationButton.tag = GPChatToolMenuViewTypeLocation;
    self.locationButton.imageView.contentMode = UIViewContentModeCenter;
    self.emojiButton.tag = GPChatToolMenuViewTypeEmoji;
    self.emojiButton.imageView.contentMode = UIViewContentModeCenter;
    
    [self.voiceButton addTarget:self action:@selector(tapMenu:) forControlEvents:UIControlEventTouchUpInside];
    [self.photosButton addTarget:self action:@selector(tapMenu:) forControlEvents:UIControlEventTouchUpInside];
    [self.cameraButton addTarget:self action:@selector(tapMenu:) forControlEvents:UIControlEventTouchUpInside];
    [self.videoButton addTarget:self action:@selector(tapMenu:) forControlEvents:UIControlEventTouchUpInside];
    [self.locationButton addTarget:self action:@selector(tapMenu:) forControlEvents:UIControlEventTouchUpInside];
    [self.emojiButton addTarget:self action:@selector(tapMenu:) forControlEvents:UIControlEventTouchUpInside];
    
}

- (void)tapMenu:(UIButton *)button
{
    if (self.callback) {
        self.callback(button.tag, button);
    }
}

@end
